<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('知识访问列表')" />
</head>
<body class="gray-bg" th:fragment="enshrine">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse" hidden>
                <form id="formIdEnshrine" hidden>
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>知识id：</label>
                                <input type="text" name="knowledgeId"/>
                            </li>
                            <li>
                                <label>创建者id：</label>
                                <input type="text" name="createId"/>
                            </li>
                            <li>
                                <label>更新者id：</label>
                                <input type="text" name="updateId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div >

            <div class="btn-group-sm" id="toolbarEnshrine" role="group" hidden>
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="hr:enshrine:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="hr:enshrine:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="hr:enshrine:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="hr:enshrine:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-tableEnshrine"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlagEnshrine = [[${@permission.hasPermi('hr:enshrine:edit')}]];
        var removeFlagEnshrine = [[${@permission.hasPermi('hr:enshrine:remove')}]];
        var prefixEnshrine = ctx + "hr/enshrine";

        $(function() {
            var optionsEnshrine = {
                id: "bootstrap-tableEnshrine",
                formId: "formIdEnshrine",
                toolbar: 'toolbarEnshrine',
                url: ctx + "hr/knowledge" + "/listEnshrine",
                removeUrl: prefixEnshrine + "/remove",
                modalName: "知识访问",
                columns: [
                    {
                        field: 'id',
                        title: '知识id',
                        visible: false
                    },
                    {
                        field: 'type',
                        title: '类型',
                        formatter: function(value, row, index) {
                            return $.table.selectDictLabel(typeDatas, value);
                        }
                    },
                    {
                        field: 'titel',
                        title: '标题'
                    },
                    {
                        field: 'cover',
                        title: '封面',
                        formatter: function(value, row, index) {

                            return $.table.imageView(value);
                        }
                    },
                    {
                        field: 'content',
                        title: '内容',
                        visible: false
                    },
                    {
                        field: 'status',
                        title: '状态',
                        formatter: function(value, row, index) {
                            if (value == '0'){
                                return '正常';
                            }
                            return '关闭';
                        }
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlagEnshrine + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="look(\'' + row.id + '\',\'isLook\')"><i class="fa fa-edit"></i>阅读</a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\',\'' + 'bootstrap-tableEnshrine' + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(optionsEnshrine);
        });
    </script>
</body>
</html>